<?php

namespace admin\models;

use Yii;

/**
 * This is the model class for table "mm_user_experience".
 *
 * @property integer $me_id
 * @property integer $mu_id
 * @property string $me_discription
 *
 * @property Info $mu
 */
class UserExperience extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'mm_user_experience';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['mu_id'], 'integer'],
            [['me_discription'], 'required'],
            [['me_discription'], 'string', 'max' => 200],
            [['mu_id'], 'exist', 'skipOnError' => true, 'targetClass' => UserInfo::className(), 'targetAttribute' => ['mu_id' => 'mi_id']],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'me_id' => '恋爱经历表',
            'mu_id' => '用户id',
            'me_discription' => '恋爱经历',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getMu()
    {
        return $this->hasOne(UserInfo::className(), ['mi_id' => 'mu_id']);
    }
}
